<?php
    class ContactsController extends AppController
	{
		var $name = 'Contacts';
		var $helpers = array('Html', 'Form', 'Javascript');
		
		function index() 
		{

		}
		
		function add() {
			$this->log($this->data);
//			if ($this->RequestHandler->isPost())
			if (!empty($this->data))
			{
				$this->Contact->set($this->data);
				if ($this->Contact->validates()) {
					//send email using the Email component
					$this->Email->to = 'vulh@softech.vn';  
					$this->Email->subject = 'Contact message from ' . $this->data['Contact']['name'];  
					$this->Email->from = $this->data['Contact']['email'];  
					$this->Email->send($this->data['Contact']['details']);
				}
			}
		}
	}
?>